<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">



<html>
  <head>
    <script type="text/javascript" src="jsonrpc.js"></script>
    <title>JSON-RPC-Java Hello</title>
   </head>

   <body bgcolor="#ffffff" onLoad="onLoad()">
    <h2>JSON-RPC-Java Hello</h2>
    <p>The JSON-RPC-Java <em>Hello World</em> application.</p>
    <p>
      <strong>Who:</strong>
      <input type="text" id="who" size="30" value="Michael" />

      &nbsp;
      <input type="button" value="Say Hello" onclick="clickHello()" />
    </p>
  </body>
  
  
  <script>
  function onLoad()
  {
      jsonrpc = new JSONRpcClient("/th/JSON-RPC");
  }
  var req = {
			"map" : {
				"rownum" : 3,
				"pss" : [["no", "name","sex","age", "score","eduTime"]],
				"cns" : ["org.usc.beans.Student"],
				"hql" : "from Student",
				"start" : 0
			},
			"javaClass" : "java.util.HashMap"
		};

  function cb1(result, exception) {
  	  if(exception) { alert(exception.msg); }
  	  // do stuff here ...
  	  req.map.objs=result;
  	  jsonrpc.BH.handle(cb2,'P',req,'');
  }
  function cb2(result, exception){
  	  if(exception) { alert(exception.msg); }
  	  
  }
  function clickHello()
  {
      var whoNode = document.getElementById("who");
      jsonrpc.BH.handle(cb1,'G',req,'');
  }
    
  </script>
</html>
